var list = [];
var promiseList = [];
var i;
for(i = 0; i < 10; i++) {
    var url = '/scm/api/v2/repositories';
    if(i > 0) {
        url += '/?page='+i;
    }
    promiseList.push(
        fetch(url, {method:'GET'})
        .then(resp => resp.json())
        .then(data => {
            if(data && data._embedded && data._embedded.repositories && data._embedded.repositories.length) {
                list = [...list, ...data._embedded.repositories];
            }
        }));
}
Promise.all(promiseList)
.then(() => {
    var text = '';
    list.map(ele => {
        text += "insert into team_project(name, code, description, organization_code, create_time, task_board_theme, template_code)\n"+
                "values('"+ele.name+"', replace(uuid(),'-', ''), '"+ele.description+"', '6v7be19pwman2fird04gqu53', now(), 'default', 0)\n"+
                "on duplicate key update description = '"+ele.description+"';\n"
    });
    console.log(text);

    var blob = new Blob([text], { type: "text/plain"}); 
    var anchor = document.createElement("a");
    anchor.download = "mysql.txt"; 
    anchor.href = window.URL.createObjectURL(blob); 
    anchor.target ="_blank"; 
    anchor.style.display = "none";
    document.body.appendChild(anchor); 
    anchor.click(); 
    document.body.removeChild(anchor); 
})

//script:var list=[];var promiseList=[];var i;for(i=0;i<10;i++){var url='/scm/api/v2/repositories';if(i>0){url+='/?page='+i}promiseList.push(fetch(url,{method:'GET'}).then(resp=>resp.json()).then(data=>{if(data&&data._embedded&&data._embedded.repositories&&data._embedded.repositories.length){list=[...list,...data._embedded.repositories]}}))}Promise.all(promiseList).then(()=>{var text='';list.map(ele=>{text+="insert into team_project(name, code, description, organization_code, create_time, task_board_theme, template_code)\nvalues('"+ele.name+"', replace(uuid(),'-', ''), '"+ele.description+"', '6v7be19pwman2fird04gqu53', now(), 'default', 0)\non duplicate key update description = '"+ele.description+"';\n"});console.log(text);var blob=new Blob([text],{type:"text/plain"});var anchor=document.createElement("a");anchor.download="mysql.txt";anchor.href=window.URL.createObjectURL(blob);anchor.target="_blank";anchor.style.display="none";document.body.appendChild(anchor);anchor.click();document.body.removeChild(anchor)})
